package oa.struts.action.base;

import java.lang.reflect.ParameterizedType;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class BaseAction<E> extends ActionSupport implements ModelDriven<E>{

	private Class classt;
	private E e;
	//--
	protected int currentPage = 1;//属性驱动，当前页码
	
	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	
	
	public BaseAction()
	{
		ParameterizedType type = (ParameterizedType) this.getClass().getGenericSuperclass();
		this.classt = (Class)type.getActualTypeArguments()[0];
		try {
			this.e = (E) this.classt.newInstance();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	@Override
	public E getModel() {
		// TODO Auto-generated method stub
		return this.e;
	}
	
	public static final String LIST_ACTION = "listAction";
//	跳转到列表页面
	public static String listAction = LIST_ACTION;
	
	public static final String UPDATE_UI = "updateUI";
//	跳转到更新页面
	public static String updateUI = UPDATE_UI;
	
	public static final String ADD_UI = "addUI";
//	跳转到添加页面
	public static String addUI = ADD_UI;
	
	public static final String ACTION2ACTION = "action2action";
//	由action跳转到action
	public static String action2action = ACTION2ACTION;
	
	
	
	

	
}
